package com.pajk.user.dal.model;

import com.pajk.user.model.Entity;

import java.io.Serializable;

/**
 * Created by Sean Gao on 4/2/14.
 */
public class UserExtDO extends Entity
        implements Serializable {

    private Long userId;
    private String domain;
    private String extKey;
    private String extData;
    private Long version;

    public UserExtDO() {
    }

    public UserExtDO(Long userId, String domain, String extKey, String extData) {
        this.userId = userId;
        this.domain = domain;
        this.extKey = extKey;
        this.extData = extData;
    }

    public UserExtDO(Long userId, String domain, String extKey, String extData, Long version) {
        this.userId = userId;
        this.domain = domain;
        this.extKey = extKey;
        this.extData = extData;
        this.version = version;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getExtKey() {
        return extKey;
    }

    public void setExtKey(String extKey) {
        this.extKey = extKey;
    }

    public String getExtData() {
        return extData;
    }

    public void setExtData(String extData) {
        this.extData = extData;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserExtDO userExtDO = (UserExtDO) o;

        if (domain != null ? !domain.equals(userExtDO.domain) : userExtDO.domain != null) return false;
        if (extData != null ? !extData.equals(userExtDO.extData) : userExtDO.extData != null) return false;
        if (extKey != null ? !extKey.equals(userExtDO.extKey) : userExtDO.extKey != null) return false;
        if (userId != null ? !userId.equals(userExtDO.userId) : userExtDO.userId != null) return false;
        if (version != null ? !version.equals(userExtDO.version) : userExtDO.version != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userId != null ? userId.hashCode() : 0;
        result = 31 * result + (domain != null ? domain.hashCode() : 0);
        result = 31 * result + (extKey != null ? extKey.hashCode() : 0);
        result = 31 * result + (extData != null ? extData.hashCode() : 0);
        result = 31 * result + (version != null ? version.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "UserExtDO{" +
                "userId=" + userId +
                ", domain='" + domain + '\'' +
                ", extKey='" + extKey + '\'' +
                ", extData='" + extData + '\'' +
                ", version=" + version +
                '}';
    }
}
